﻿using System;
using System.Globalization;
using TabbedTemplate.Util;
using Xamarin.Forms;

namespace TabbedTemplate.Converters
{
    public class ConvertTimeStamp : IValueConverter
    {
        public static DateTime ConvertTimeStampToDate(long timeStamp) =>
            new DateTime(timeStamp);

        public object Convert(object value, Type targetType, object parameter,
            CultureInfo culture)
        {
            long timestamp = System.Convert.ToInt64(value);

            return new DateTime(timestamp);
        }
        public object ConvertBack(object value, Type targetType, object parameter,
            CultureInfo culture)
        {
            throw new DoNotCallThisException();
        }
    }
}
